﻿using System;
using System.Collections.Generic;
using ParserGenerator.Collections;

namespace ParserGenerator.ParserConstruction
{
    [Serializable]
    public sealed class ParserAutomatonContributionColumn : ReadOnlySet<ParserAutomatonItem>
    {
        internal ParserAutomatonContributionColumn()
            : base(new HashSet<ParserAutomatonItem>())
        {
        }

        internal bool Add(ParserAutomatonItem item)
        {
            if (item == null)
                throw new ArgumentNullException(nameof(item));
            return Set.Add(item);
        }

        internal void UnionWith(IEnumerable<ParserAutomatonItem> collection)
        {
            if (collection == null)
                throw new ArgumentNullException(nameof(collection));
            Set.UnionWith(collection);
        }
    }
}
